//
//  ViewController.m
//  Screen Touches
//
//  Created by iD Student on 6/28/13.
//  Copyright (c) 2013 iD Student. All rights reserved.
//

#import "ViewController.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
	// Do any additional setup after loading the view, typically from a nib.
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (void) touchesBegan:(NSSet *) touches withEvent: (UIEvent *) event
{
    UITouch *touch = [touches anyObject];
    CGPoint touchPoint = [touch locationInView:[self view]];
    int x = touchPoint.x;
    int y = touchPoint.y;
    NSLog(@"Your touch began at location %d,%d.", x, y);
}

- (void) touchesEnded: (NSSet *) touches withEvent:(UIEvent *)event
{
    UITouch *touch = [touches anyObject];
    CGPoint touchPoint = [touch locationInView: [self view]];
    int x = touchPoint.x;
    int y = touchPoint.y;
    NSLog(@"Your touch released from %d,%d.", x, y);
}
- (void) touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
    UITouch *touch = [touches anyObject];
    CGPoint currentTouchPoint = [touch locationInView:[self view]];
    CGPoint previousTouchPoint = [touch previousLocationInView:[self view]];
    int px = previousTouchPoint.x;
    int py = previousTouchPoint.y;
    int cx = currentTouchPoint.x;
    int cy = currentTouchPoint.y;
    NSLog(@"Your touch moved from %d,%d to %d,%d.", px, py, cx, cy);
}
@end
